﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Movizard.Model
{
    public class Movie
    {
        public string Id { get; set; }
        public string Title { get; set; }
        public string OriginalTitle { get; set; }
        public string Year { get; set; }
        public string Rating { get; set; }
        public StringCollection Genres { get; set; }
        public StringCollection Directors { get; set; }
        public StringCollection Writers { get; set; }
        public StringCollection Stars { get; set; }
        public StringCollection Cast { get; set; }
        public string MpaaRating { get; set; }
        public string ReleaseDate { get; set; }
        public string Plot { get; set; }
        public string Poster { get; set; }
        public string PosterLarge { get; set; }
        public string PosterSmall { get; set; }
        public string PosterFull { get; set; }
        public string Runtime { get; set; }
        public string Top250 { get; set; }
        public string Oscars { get; set; }
        public string Awards { get; set; }
        public string Nominations { get; set; }
        public string Storyline { get; set; }
        public string Tagline { get; set; }
        public string Votes { get; set; }
        public StringCollection Languages { get; set; }
        public StringCollection Countries { get; set; }
        public StringCollection ReleaseDates { get; set; }
        public StringCollection MediaImages { get; set; }
        public string ImdbURL { get; set; }

        public Movie()
        {
            this.Genres = new StringCollection();
            this.Directors = new StringCollection();
            this.Writers = new StringCollection();
            this.Stars = new StringCollection();
            this.Cast = new StringCollection();
            this.Languages = new StringCollection();
            this.Countries = new StringCollection();
            this.ReleaseDates = new StringCollection();
            this.MediaImages = new StringCollection();
        }

        public static Movie CreateFromIMDB(IMDB.IMDb iMDBMovie)
        {
            if (iMDBMovie.status)
            {
                Movie result = new Movie();
                result.Awards = iMDBMovie.Awards;
                result.Cast.AddRange(iMDBMovie.Cast.Cast<string>());
                result.Countries.AddRange(iMDBMovie.Countries.Cast<string>());
                result.Directors.AddRange(iMDBMovie.Directors.Cast<string>());
                result.Genres.AddRange(iMDBMovie.Genres.Cast<string>());
                result.Id = iMDBMovie.Id;
                result.ImdbURL = iMDBMovie.ImdbURL;
                result.Languages.AddRange(iMDBMovie.Languages.Cast<string>());
                result.MediaImages.AddRange(iMDBMovie.MediaImages.Cast<string>());
                result.MpaaRating = iMDBMovie.MpaaRating;
                result.Nominations = iMDBMovie.Nominations;
                result.OriginalTitle = iMDBMovie.OriginalTitle;
                result.Oscars = iMDBMovie.Oscars;
                result.Plot = iMDBMovie.Plot;
                result.Poster = iMDBMovie.Poster;
                result.PosterFull = iMDBMovie.PosterFull;
                result.PosterLarge = iMDBMovie.PosterLarge;
                result.PosterSmall = iMDBMovie.PosterSmall;
                result.Rating = iMDBMovie.Rating;
                result.ReleaseDate = iMDBMovie.ReleaseDate;
                result.ReleaseDates.AddRange(iMDBMovie.ReleaseDates.Cast<string>());
                result.Runtime = iMDBMovie.Runtime;
                result.Stars.AddRange(iMDBMovie.Stars.Cast<string>());
                result.Storyline = iMDBMovie.Storyline;
                result.Tagline = iMDBMovie.Tagline;
                result.Title = iMDBMovie.Title;
                result.Top250 = iMDBMovie.Top250;
                result.Votes = iMDBMovie.Votes;
                result.Writers.AddRange(iMDBMovie.Writers.Cast<string>());
                result.Year = iMDBMovie.Year;

                return result;
            }
            else
                return null;
        }

        public override string ToString()
        {
            return this.Title;
        }

    }
}
